package com.igeekhome.wzgl.controller;

import com.igeekhome.wzgl.entity.MaterialStorageEntity;
import com.igeekhome.wzgl.service.IMaterialStorage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/mz")
@CrossOrigin
public class MaterialStorageController {
    @Autowired
    private IMaterialStorage iMaterialStorage;
    @GetMapping("/page")
    public List<MaterialStorageEntity> page(){return iMaterialStorage.page();}
    @PostMapping("/insert")
    public int insert(@RequestBody MaterialStorageEntity mz){
        return iMaterialStorage.insert(mz);
    }
    @GetMapping("/delete")
    public int delete(@RequestParam int id){
        return iMaterialStorage.delete(id);
    }
    @PostMapping("/update")
    public int update(@RequestBody MaterialStorageEntity mz){
        return iMaterialStorage.update(mz);
    }
    @GetMapping("/select")
    public List<MaterialStorageEntity> select(@RequestParam int id){
        return iMaterialStorage.select(id);
    }
    @GetMapping("/getById")
    public MaterialStorageEntity getById(@RequestParam int id){
        return iMaterialStorage.getById(id);
    }
}
